package org.elanfox.cloud.data.jpa.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.time.LocalDateTime;

/**
 * @author allan
 * @date 2019-08-19
 */
@Setter
@Getter
@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
@Where(clause = "is_deleted=0")
public class BasePO {
    /**
     * 创建时间
     */
    @Column(name = "create_time")
    @CreatedDate
    private LocalDateTime createTime;
    /**
     * 修改时间
     */
    @Column(name = "update_time")
    @LastModifiedDate
    private LocalDateTime updateTime;
    /**
     * 创建者
     */
    private String creator;
    /**
     * 是否删除
     */
    @Column(name = "is_deleted")
    private boolean deleted;
}
